package com.secsbrain.development.biz.constant;

import java.util.Arrays;
import java.util.List;

/**
 * 任务类型
 * Created by yangyang.zhang on 2017/6/20.
 */
public enum TaskType {
    PACKAGE("打包", "sh /home/salt/01.git.sh {url} {branch} none {env} {appType} {disconfVersion}"),
    DEPLOY("发布", "sh /home/salt/02.deploy.sh {url} {branch} {hostName} {env} {appType}"),
    RESTART("重启", "sh /home/salt/03.restart.sh none none {hostName} {env} {appType}"),
    ROLLBACK("回滚", "sh /home/salt/04.rollback.sh {url} {branch} {hostName} {env} {appType}");

    TaskType(String name, String commandTemplate) {
        this.name = name;
        this.commandTemplate = commandTemplate;
    }

    private String name;
    private String commandTemplate;

    public String getName() {
        return name;
    }

    public String getCommandTemplate() {
        return commandTemplate;
    }

    public static List<TaskType> deploy() {
        return Arrays.asList(PACKAGE, DEPLOY);
    }
}
